﻿Module draw

    Public ReNameColor As Color
    Public ReplaceColor As Color
    Public ReferencedColor As Color
    Public SelecdColor As Color
    Public SelecdItem As ListViewItem

    '设置listview每行颜色,listview对象,奇数行颜色,偶数行颜色
    Public Sub Set_LV_Color(ByVal ObjectListView As ListView, ByVal JiListItemColor As Color, ByVal OuListItemColor As Color)
        Dim LVI As ListViewItem
        For Each LVI In ObjectListView.Items
            If (LVI.Index Mod 2) = 1 Then
                LVI.BackColor = JiListItemColor ' Color.AliceBlue       '奇数行
            Else
                LVI.BackColor = OuListItemColor  ' Color.White          '偶数行
            End If

        Next
    End Sub

    '添加日志 listview对象,日志消息,颜色
    Public Sub Add_MessageLV(ByVal ObjectLV As ListView, ByVal Message As String, ByVal ItemColor As Color)
        Dim ListItem As Object
        ListItem = ObjectLV.Items.Add(Message)
        ListItem.BackColor = ItemColor
        ListItem.EnsureVisible()
        ObjectLV.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent)
        If ObjectLV.Columns(0).Width < ObjectLV.Width Then ObjectLV.Columns(0).Width = ObjectLV.Width - 10
    End Sub
End Module
